<!DOCTYPE html>
<html>
  <head>
    <title>To Arrays</title>
    <link href="https://fonts.googleapis.com/css?family=Lato|Roboto|Source+Code+Pro" rel="stylesheet">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/styles/monokai.min.css">
    <link rel="stylesheet" href="demo.css">
  </head>

  <body>

    <div id="header">
      <h1 id="title">$.csv.toArrays()</h1>
      <div id="link"><a href="https://github.com/typeiii/jquery-csv">GitHub</a></div>
    </div>
    <div id="container">
      <section id="content">
        <h2>Description</h2>
        <p>Used to parse multi-line CSV data into a JavaScript 2D (two-dimensional) array.</p>
        <hr>
        <h2>Usage</h2>
        <pre><code class="javascript">var result = $.csv.toArrays(input);</code></pre>
        <hr />
        <h2>Input</h2>
        <textarea id="input" style="height: 155px;">"All work","and no play","makes Jack","a dull boy..."
"All work","and no play","makes Jack","a dull boy..."
"All work","and no play","makes Jack","a dull boy..."
"All work","and no play","makes Jack","a dull boy..."
"All work","and no play","makes Jack","a dull boy..."
"All work","and no play","makes Jack","a dull boy..."
"All work","and no play","makes Jack","a dull boy..."
"All work","and no play","makes Jack","a dull boy..."
"All work","and no play","makes Jack","a dull boy..."
"All work","and no play","makes Jack","a dull boy..."</textarea>
        <input id="run" type="button" value="Run" />
        <hr />
        <h2>Result</h2>
        <textarea id="result" style="height: 940px;"></textarea>
      </section>
    </div>

    <script src="http://code.jquery.com/jquery-3.3.1.slim.js" integrity="sha256-fNXJFIlca05BIO2Y5zh1xrShK3ME+/lYZ0j+ChxX2DA=" crossorigin="anonymous"></script>
    <script src="../src/jquery.csv.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/highlight.min.js"></script>
    <script>
      // enable syntax highlighting
      hljs.initHighlightingOnLoad();

      $(document).ready(() => {
        parse();
      });

      $('#run').bind('click', function () {
        parse();
      });

      function parse() {
        const input = $('#input').val();
        const data = $.csv.toArrays(input);
        $('#result').empty();
        $('#result').html(JSON.stringify(data, null, 2));
      }
    </script>
  </body>
</html>